<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>RTP Template</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html">
<img src="../docs-assets/Inform.png" height=72">
</a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../indocn.html">indoc</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=18> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="../../../inweb/index.html">inweb</a></li>
<li><a href="../../../intest/index.html">intest</a></li>

</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'RTP Template' generated by Inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../extensions.html">Kits</a></li><li><a href="index.html">BasicInformKit</a></li><li><b>RTP Template</b></li></ul></div>
<p class="purpose">To issue run-time problem messages, and to perform some run-time type checking which may issue such messages.</p>

<ul class="toc"><li><a href="S-rtp.html#SP1">&#167;1. Reporting</a></li><li><a href="S-rtp.html#SP2">&#167;2. The VeneerError RTP</a></li><li><a href="S-rtp.html#SP3">&#167;3. RTPs issued by the compiler</a></li><li><a href="S-rtp.html#SP4">&#167;4. Return Type Checking Failed</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Reporting. </b>All RTPs are produced by calling <span class="extract"><span class="extract-syntax">IssueRTP</span></span>. This does not necessarily issue
the problem right away, since reporting of these can be temporarily suspended,
and we also want to avoid long cascades of repeated RTPs.
</p>

<p class="commentary">The only compulsory argument is <span class="extract"><span class="extract-syntax">name</span></span>, which is used by the Inform GUI apps
to notice that RTPs have been issued and to display an appropriate page of
explanatory documentation. The apps notice RTPs by looking for a particular
pattern of text, so do not reformat RTPs without coordinating with the apps.
</p>

<p class="commentary">It is usual also to give <span class="extract"><span class="extract-syntax">desc</span></span> and <span class="extract"><span class="extract-syntax">set</span></span>. <span class="extract"><span class="extract-syntax">desc</span></span> is a description, which
can either be a string or a function which takes the three parameters and
prints out a line of description instead. <span class="extract"><span class="extract-syntax">set</span></span> should be a constant identifying
which kit of code issued the RTP: for example, <span class="extract"><span class="extract-syntax">BasicInformKitRTPs</span></span>. If an RTP
does not belong to the right set, the GUI apps won't be able to display
helpful pages about it.
</p>

<p class="commentary">The arguments <span class="extract"><span class="extract-syntax">par1</span></span>, <span class="extract"><span class="extract-syntax">par2</span></span> and <span class="extract"><span class="extract-syntax">par3</span></span> are optional parameters which are
passed to the <span class="extract"><span class="extract-syntax">desc</span></span> function, if there is one.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">Array</span><span class="plain-syntax"> </span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax"> --&gt;</span>
<span class="plain-syntax">    (-1)    </span><span class="comment-syntax">--&gt;0 = Name of current RTP, or -1 for none, or -2 for issued already</span>
<span class="plain-syntax">    </span><span class="constant-syntax">0</span><span class="plain-syntax">       </span><span class="comment-syntax">--&gt;1 = par1 value</span>
<span class="plain-syntax">    </span><span class="constant-syntax">0</span><span class="plain-syntax">       </span><span class="comment-syntax">--&gt;2 = par2 value</span>
<span class="plain-syntax">    </span><span class="constant-syntax">0</span><span class="plain-syntax">       </span><span class="comment-syntax">--&gt;3 = par3 value</span>
<span class="plain-syntax">    </span><span class="constant-syntax">0</span><span class="plain-syntax">       </span><span class="comment-syntax">--&gt;4 = description string or function</span>
<span class="plain-syntax">    </span><span class="constant-syntax">0</span><span class="plain-syntax">       </span><span class="comment-syntax">--&gt;5 = set value</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">false</span><span class="plain-syntax">;  </span><span class="comment-syntax">--&gt;6 = suspension flag (true if suspended, false if not)</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">IssueRTP</span><span class="plain-syntax"> </span><span class="identifier-syntax">name</span><span class="plain-syntax"> </span><span class="identifier-syntax">desc</span><span class="plain-syntax"> </span><span class="identifier-syntax">set</span><span class="plain-syntax"> </span><span class="identifier-syntax">par1</span><span class="plain-syntax"> </span><span class="identifier-syntax">par2</span><span class="plain-syntax"> </span><span class="identifier-syntax">par3</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">name</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">String</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        ((</span><span class="identifier-syntax">desc</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">String</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">desc</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">Routine</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">desc</span><span class="plain-syntax"> == -1)) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">set</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">String</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;0 == -1) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;0 = </span><span class="identifier-syntax">name</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;1 = </span><span class="identifier-syntax">par1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;2 = </span><span class="identifier-syntax">par2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;3 = </span><span class="identifier-syntax">par3</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;4 = </span><span class="identifier-syntax">desc</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;5 = </span><span class="identifier-syntax">set</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ShowRTP</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="string-syntax">"*** Improper call to IssueRTP ***"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">];</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">ClearRTP</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;0 = -1;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;6 = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">SuspendRTP</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;6 = </span><span class="reserved-syntax">true</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">ResumeRTP</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;6 = </span><span class="reserved-syntax">false</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">ShowRTP</span><span class="plain-syntax">   </span><span class="identifier-syntax">name</span><span class="plain-syntax"> </span><span class="identifier-syntax">par1</span><span class="plain-syntax"> </span><span class="identifier-syntax">par2</span><span class="plain-syntax"> </span><span class="identifier-syntax">par3</span><span class="plain-syntax"> </span><span class="identifier-syntax">desc</span><span class="plain-syntax"> </span><span class="identifier-syntax">suspended</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;0 == -1 </span><span class="reserved-syntax">or</span><span class="plain-syntax"> -2) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;6) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;0;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">par1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;1;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">par2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;2;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">par3</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;3;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;0 = -2;</span>

<span class="plain-syntax">#</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">TARGET_GLULX</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">suspended</span><span class="plain-syntax"> = </span><span class="identifier-syntax">SuspendTextInput</span><span class="plain-syntax">(</span><span class="identifier-syntax">Main_Window</span><span class="plain-syntax">);</span>
<span class="plain-syntax">#</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"^*** Run-time problem "</span><span class="plain-syntax">, (</span><span class="reserved-syntax">string</span><span class="plain-syntax">) </span><span class="identifier-syntax">name</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;5) { </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">": "</span><span class="plain-syntax">, (</span><span class="reserved-syntax">string</span><span class="plain-syntax">) </span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;5; }</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">desc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LatestRTPData</span><span class="plain-syntax">--&gt;4;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">desc</span><span class="plain-syntax"> ~= -1) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"*** "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">desc</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">String</span><span class="plain-syntax">) </span><span class="reserved-syntax">print</span><span class="plain-syntax"> (</span><span class="reserved-syntax">string</span><span class="plain-syntax">) </span><span class="identifier-syntax">desc</span><span class="plain-syntax">, </span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">desc</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">Routine</span><span class="plain-syntax">) </span><span class="identifier-syntax">desc</span><span class="plain-syntax">(</span><span class="identifier-syntax">par1</span><span class="plain-syntax">, </span><span class="identifier-syntax">par2</span><span class="plain-syntax">, </span><span class="identifier-syntax">par3</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">#</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">TARGET_GLULX</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">suspended</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ResumeTextInput</span><span class="plain-syntax">(</span><span class="identifier-syntax">Main_Window</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">#</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. The VeneerError RTP. </b>The following function, confusingly called <span class="extract"><span class="extract-syntax">RunTimeError</span></span> and not to be
confused with <span class="extract"><span class="extract-syntax">IssueRTP</span></span> above, is a residue from the old I6 library. Most of
its possible messages can't be seen in I7 use &mdash; for instance I7 has no timers
or daemons, so error 4 is out of the question. We retain it only because the
veneer code added by I6 requires it to be present.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">Constant</span><span class="plain-syntax"> </span><span class="identifier-syntax">MAX_TIMERS</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">[ </span><span class="identifier-syntax">RunTimeError</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax"> </span><span class="identifier-syntax">p1</span><span class="plain-syntax"> </span><span class="identifier-syntax">p2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">IssueRTP</span><span class="plain-syntax">(</span><span class="string-syntax">"VeneerError"</span><span class="plain-syntax">, </span><span class="string-syntax">"Low level error."</span><span class="plain-syntax">, </span><span class="identifier-syntax">BasicInformKitRTPs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"*** Veneer error "</span><span class="plain-syntax">, </span><span class="identifier-syntax">n</span><span class="plain-syntax">, </span><span class="string-syntax">" ("</span><span class="plain-syntax">, </span><span class="identifier-syntax">p1</span><span class="plain-syntax">, </span><span class="string-syntax">","</span><span class="plain-syntax">, </span><span class="identifier-syntax">p2</span><span class="plain-syntax">, </span><span class="string-syntax">")^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Ifdef</span><span class="plain-syntax"> </span><span class="identifier-syntax">DEBUG</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"*** "</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">n</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">      </span><span class="constant-syntax">1</span><span class="plain-syntax">:    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"preposition not found (this should not occur)"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">      </span><span class="constant-syntax">2</span><span class="plain-syntax">:    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"Property value not routine or string: ~"</span><span class="plain-syntax">, (</span><span class="identifier-syntax">property</span><span class="plain-syntax">) </span><span class="identifier-syntax">p2</span><span class="plain-syntax">, </span><span class="string-syntax">"~ of ~"</span><span class="plain-syntax">, (</span><span class="identifier-syntax">name</span><span class="plain-syntax">) </span><span class="identifier-syntax">p1</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                  </span><span class="string-syntax">"~ ("</span><span class="plain-syntax">, </span><span class="identifier-syntax">p1</span><span class="plain-syntax">, </span><span class="string-syntax">")"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">      </span><span class="constant-syntax">3</span><span class="plain-syntax">:    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"Entry in property list not routine or string: ~"</span><span class="plain-syntax">, (</span><span class="identifier-syntax">property</span><span class="plain-syntax">) </span><span class="identifier-syntax">p2</span><span class="plain-syntax">, </span><span class="string-syntax">"~ list of ~"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                  (</span><span class="identifier-syntax">name</span><span class="plain-syntax">) </span><span class="identifier-syntax">p1</span><span class="plain-syntax">, </span><span class="string-syntax">"~ ("</span><span class="plain-syntax">, </span><span class="identifier-syntax">p1</span><span class="plain-syntax">, </span><span class="string-syntax">")"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">      </span><span class="constant-syntax">4</span><span class="plain-syntax">:    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"Too many timers/daemons are active simultaneously.</span>
<span class="string-syntax">                  The limit is the library constant MAX_TIMERS (currently "</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                  </span><span class="identifier-syntax">MAX_TIMERS</span><span class="plain-syntax">, </span><span class="string-syntax">") and should be increased"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">      </span><span class="constant-syntax">5</span><span class="plain-syntax">:    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"Object ~"</span><span class="plain-syntax">, (</span><span class="identifier-syntax">name</span><span class="plain-syntax">) </span><span class="identifier-syntax">p1</span><span class="plain-syntax">, </span><span class="string-syntax">"~ has no ~time_left~ property"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">      </span><span class="constant-syntax">7</span><span class="plain-syntax">:    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"The object ~"</span><span class="plain-syntax">, (</span><span class="identifier-syntax">name</span><span class="plain-syntax">) </span><span class="identifier-syntax">p1</span><span class="plain-syntax">, </span><span class="string-syntax">"~ can only be used as a player object if it has</span>
<span class="string-syntax">                  the ~number~ property"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">      </span><span class="constant-syntax">8</span><span class="plain-syntax">:    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"Attempt to take random entry from an empty table array"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">      </span><span class="constant-syntax">9</span><span class="plain-syntax">:    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="identifier-syntax">p1</span><span class="plain-syntax">, </span><span class="string-syntax">" is not a valid direction property number"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">      </span><span class="constant-syntax">10</span><span class="plain-syntax">:   </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"The player-object is outside the object tree"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">      </span><span class="constant-syntax">11</span><span class="plain-syntax">:   </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"The room ~"</span><span class="plain-syntax">, (</span><span class="identifier-syntax">name</span><span class="plain-syntax">) </span><span class="identifier-syntax">p1</span><span class="plain-syntax">, </span><span class="string-syntax">"~ has no ~description~ property"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">      </span><span class="constant-syntax">12</span><span class="plain-syntax">:   </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"Tried to set a non-existent pronoun using SetPronoun"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">      </span><span class="constant-syntax">13</span><span class="plain-syntax">:   </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"A 'topic' token can only be followed by a preposition"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">      </span><span class="reserved-syntax">default</span><span class="plain-syntax">: </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"(unexplained)"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    #</span><span class="identifier-syntax">Endif</span><span class="plain-syntax">; </span><span class="comment-syntax">DEBUG</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. RTPs issued by the compiler. </b>Or properly speaking, by code generated by the Inform 7 compiler, usually in
response to runtime type-checking having failed. Rather than calling <span class="extract"><span class="extract-syntax">IssueRTP</span></span>
directly, it calls one of the following.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">IssueTypecheckingRTP</span><span class="plain-syntax"> </span><span class="identifier-syntax">line</span><span class="plain-syntax"> </span><span class="identifier-syntax">file</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">IssueRTP</span><span class="plain-syntax">(</span><span class="string-syntax">"PhraseAppliedToIncompatibleValue"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"Phrase applied to an incompatible kind of value."</span><span class="plain-syntax">, </span><span class="identifier-syntax">BasicInformKitRTPs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">IssueIterationRTP</span><span class="plain-syntax"> </span><span class="identifier-syntax">what</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">IssueRTP</span><span class="plain-syntax">(</span><span class="string-syntax">"RepeatedThroughUnenumerableKind"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"Could not iterate through values of this kind."</span><span class="plain-syntax">, </span><span class="identifier-syntax">BasicInformKitRTPs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"*** This arose from a description which started out here - ~"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        (</span><span class="reserved-syntax">string</span><span class="plain-syntax">) </span><span class="identifier-syntax">what</span><span class="plain-syntax">, </span><span class="string-syntax">"~.^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">IssueSetVariableRTP</span><span class="plain-syntax"> </span><span class="identifier-syntax">val</span><span class="plain-syntax"> </span><span class="identifier-syntax">setting</span><span class="plain-syntax"> </span><span class="identifier-syntax">kind</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">IssueRTP</span><span class="plain-syntax">(</span><span class="string-syntax">"SetVariableToWrongKindOfObject"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"Tried to set a variable to the wrong kind of object."</span><span class="plain-syntax">, </span><span class="identifier-syntax">BasicInformKitRTPs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"*** You wrote '"</span><span class="plain-syntax">, (</span><span class="reserved-syntax">string</span><span class="plain-syntax">) </span><span class="identifier-syntax">setting</span><span class="plain-syntax">, </span><span class="string-syntax">"', which sets the value to "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">val</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">" - but that doesn't have the kind '"</span><span class="plain-syntax">, (</span><span class="reserved-syntax">string</span><span class="plain-syntax">) </span><span class="identifier-syntax">kind</span><span class="plain-syntax">, </span><span class="string-syntax">"'.^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">IssueChangedRelationRTP</span><span class="plain-syntax"> </span><span class="identifier-syntax">X</span><span class="plain-syntax"> </span><span class="identifier-syntax">Y</span><span class="plain-syntax"> </span><span class="identifier-syntax">rel</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">IssueRTP</span><span class="plain-syntax">(</span><span class="string-syntax">"ChangedRelationOutsideDomain"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"Tried to change a relation for objects with the wrong kinds."</span><span class="plain-syntax">, </span><span class="identifier-syntax">BasicInformKitRTPs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">print</span><span class="plain-syntax"> </span><span class="string-syntax">"*** The relation was set up as ~"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        (</span><span class="reserved-syntax">string</span><span class="plain-syntax">) </span><span class="identifier-syntax">RlnGetF</span><span class="plain-syntax">(</span><span class="identifier-syntax">rel</span><span class="plain-syntax">, </span><span class="identifier-syntax">RR_DESCRIPTION</span><span class="plain-syntax">), </span><span class="string-syntax">"~, but you tried to "</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"relate (or unrelate) "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">X</span><span class="plain-syntax">, </span><span class="string-syntax">" to "</span><span class="plain-syntax">, (</span><span class="identifier-syntax">the</span><span class="plain-syntax">) </span><span class="identifier-syntax">Y</span><span class="plain-syntax">, </span><span class="string-syntax">".^"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>

<span class="plain-syntax">[ </span><span class="identifier-syntax">IssueAbstractRelationRTP</span><span class="plain-syntax"> </span><span class="identifier-syntax">task</span><span class="plain-syntax"> </span><span class="identifier-syntax">rel</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">IssueRTP</span><span class="plain-syntax">(</span><span class="string-syntax">"UsedAbstractRelation"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"Tried to make use of an abstract relation."</span><span class="plain-syntax">, </span><span class="identifier-syntax">BasicInformKitRTPs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">rtrue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. Return Type Checking Failed. </b>Similarly, though in a more restricted set of circumstances. Inform can usually
prove that the value returned by a phrase matches its supposed kind, but
because of the deliberately weak type-checking within the kind of value
"object" it will allow a broader kind of object to be returned when the
requirement is for a narrower one. In such cases, it checks the result with
the following routine. The value <span class="extract"><span class="extract-syntax">V</span></span> is a valid "object", but that means
it can be <span class="extract"><span class="extract-syntax">nothing</span></span>, and we must check that it matches a given I7 kind <span class="extract"><span class="extract-syntax">K</span></span>
(where <span class="extract"><span class="extract-syntax">nothing</span></span> is not valid).
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">[ </span><span class="identifier-syntax">CheckKindReturned</span><span class="plain-syntax"> </span><span class="identifier-syntax">V</span><span class="plain-syntax"> </span><span class="identifier-syntax">K</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">V</span><span class="plain-syntax"> </span><span class="reserved-syntax">ofclass</span><span class="plain-syntax"> </span><span class="identifier-syntax">K</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">V</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">V</span><span class="plain-syntax"> == </span><span class="reserved-syntax">nothing</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">IssueRTP</span><span class="plain-syntax">(</span><span class="string-syntax">"DecidedOnNothing"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"Attempt to 'decide on nothing'."</span><span class="plain-syntax">, </span><span class="identifier-syntax">BasicInformKitRTPs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">IssueRTP</span><span class="plain-syntax">(</span><span class="string-syntax">"DecidedOnWrongKindOfObject"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"Attempt to 'decide on V' where V is the wrong kind of object."</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">BasicInformKitRTPs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">V</span><span class="plain-syntax">;</span>
<span class="plain-syntax">];</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="S-prp.html">&#10094;</a></li><li class="progresssection"><a href="S-dfn.html">dfn</a></li><li class="progresssection"><a href="S-str.html">str</a></li><li class="progresssection"><a href="S-utl.html">utl</a></li><li class="progresssection"><a href="S-prg.html">prg</a></li><li class="progresssection"><a href="S-mth.html">mth</a></li><li class="progresssection"><a href="S-srt.html">srt</a></li><li class="progresssection"><a href="S-tbl.html">tbl</a></li><li class="progresssection"><a href="S-mst.html">mst</a></li><li class="progresssection"><a href="S-rlb.html">rlb</a></li><li class="progresssection"><a href="S-act.html">act</a></li><li class="progresssection"><a href="S-prn.html">prn</a></li><li class="progresssection"><a href="S-flx.html">flx</a></li><li class="progresssection"><a href="S-blc.html">blc</a></li><li class="progresssection"><a href="S-knd.html">knd</a></li><li class="progresssection"><a href="S-txt.html">txt</a></li><li class="progresssection"><a href="S-chr.html">chr</a></li><li class="progresssection"><a href="S-rgx.html">rgx</a></li><li class="progresssection"><a href="S-lst.html">lst</a></li><li class="progresssection"><a href="S-cmb.html">cmb</a></li><li class="progresssection"><a href="S-rlt.html">rlt</a></li><li class="progresssection"><a href="S-rlt2.html">rlt2</a></li><li class="progresssection"><a href="S-prp.html">prp</a></li><li class="progresscurrent">rtp</li><li class="progressnextoff">&#10095;</li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

